package com.yenlien.traceyun.plant.dao;

import com.alibaba.fastjson.JSONObject;
import com.yenlien.traceyun.plant.entity.Article;
import com.yenlien.traceyun.webase.dao.BaseJpaDao;
import org.springframework.data.jpa.repository.Query;

import java.util.List;


public interface ArticleDao extends BaseJpaDao<Article> {



//    @Query(value = "SELECT id, `name` FROM t_fruit_article WHERE company_id = ?1 AND state = '2' AND (timely = '1' OR NOW() BETWEEN publish_time_start AND publish_time_end)", nativeQuery = true)
    @Query(value = "SELECT id, `title` FROM t_fruit_article WHERE company_id = ?1 AND state = '2'  ORDER BY create_time DESC", nativeQuery = true)
    List<JSONObject> getIdNameByState(String companyId);


    @Query(value = "SELECT * FROM t_fruit_article WHERE state = '2' ORDER BY create_time DESC", nativeQuery = true)
    List<JSONObject> getIdNameTitleByState();





}
